<style type="text/css">
.sizetable th,.sizetable td{padding:3px 5px !important;text-align:center;}
.layui-table td, .layui-table th {padding:6px 9px;}
</style>
    <div>
        <form  class="layui-form layui-form-pane fixed-bar-form" action="{:url('')}" method="post" id="hisi-table-search">
       <div>
        	<table class="layui-table" style="width:100%" id="demo1" lay-filter="demo1">
                <thead>
                    <tr>
                      <th>工序process_id</th>
                        <th>工序名称</th>
                        <th>工价</th>
                        <th>动作名</th>
                        <th>编辑人员</th>
                        <th>编辑时间</th>
                    </tr>
                </thead>
                <tbody class="edit_process_body">
                    {foreach $datalist as $k => $v}
                    <tr>
                      <td style="padding:3px 10px;">{$v['process_price_id']}<input type="hidden" name="data_id[]" value="{$v['id']}"></td>
                          <td>{$v['process_name']}</td>
                          <td>{$v['process_price']}</td>
                          <td>{$v['status_action_txt']}</td>
                          <td>{$v['actionuser']}</td>
                          <td>{$v['create_time']}</td>
              </tr>
                    {/foreach}
                </tbody>
            </table>
         <input type="hidden" name="stage" value="{$stage}">
         <input type="hidden" name="sku" value="{$sku}">
         <input type="hidden" name="delete_ids" value="">
        <div class="pop-bottom-bar">
            <a href="javascript:parent.layui.layer.closeAll();" class="layui-btn layui-btn-primary ml10">取消</a>
        </div>
       </div>

        </form>
    </div>
<table id="dataTable"></table>
<div id="temp" style="display:none">
    <table id="temptable"><tr>
        <td style="padding:3px 10px;"><input type="hidden" name="data_id[]" value=""></td>
        <td><input type="text" name="process_name[]" value="" tabindex="100" autocomplete="off" style="width:100px;" lay-verify="required"></td>
        <td><input type="text" name="process_price[]" value="" tabindex="100" autocomplete="off" lay-verify="required|number" style="width:100px;"></td>
        <td><a class="layui-btn layui-btn-xs layui-btn-danger" style="margin-left:5px;" lay-event="delete" onclick="removePrice(this)">删除</a></td>
    </tr>
    </table>
</div>
{include file="system@block/layui" /}
<script>
	layui.use(['tool','laydate','table','form'], function() {
		var element = layui.element;
		var layer = layui.layer;
		var $ = layui.jquery;
		var form = layui.form;
		var table = layui.table;

		function doSaveStock(data){
			$.ajax({
			   type: "POST",
			   url: "{:url('mp/ProcessPrice/editProcessPrice?action=dosave')}",
			   data: data,
			   dataType:"json",
			   success: function(res){
					var data=res.data;
					if(res.code==1){
						if($("#editsubmitbtn").attr("btn_name")=='edit_one'){
							$("#editsubmitbtn").html("保存成功");
							setTimeout(function(){
								parent.layui.layer.closeAll();
								parent.reloadTable();
							},1000);
							layer.msg('修改成功', {icon: 1,anim: 6});
							return;
						}

					}else{
						//alert(res.msg);
						$("#action_result").html(res.msg);
					}

			   }
			});
		}
        form.on('submit(demo1)', function (data) {
            //表单数据formData
            var formData;
            formData = data.field;
            doSaveStock(formData)
        })
        $(document).on('click', '.processAdd', function(){
            var addhtml=$("#temptable").find("tr").eq(0).clone();
            $(".edit_process_body").append(addhtml);
        });
		
		// 监听物料切换，显示mes幅宽
		window.removePrice = function(e) {
			var tr=$(e).parent().parent();
			$(e).parent().parent().remove();

			//$(".edit_process_body").remove()
		}
	});
</script>